<template>
	<view>
		<view class="Talent_recommendation ">
			<view class="Talent_recommendation_bottom" @click="detail(item)" v-for="(item,index) in dataList" :key="index">
				<view class="trb_top dis_flex">
					<view class="trb_top_left dis_flex">
						<image :src="webImgUrl+item.photo" mode="" />
						<view class="trbtl_right">
							<view class="trbtl_top">
								<view>{{item.personName}}</view>
								<image v-if="item.state=='111111'"  src="../../static/icon/tuijian.png" mode="" />
							</view>
							<view class="trbtl_bottom dis_flex">
								<text v-if="item.age!=null || item.age!=''">{{item.age}}岁</text>
								<view class="line" v-if="item.background!=null && item.background!=''"></view>
								<view v-if="item.background!=null || item.background!=''">{{item.background}}</view>
								<view class="line"  v-if="item.education!=null && item.education!=''"></view>
								<text v-if="item.education!=null || item.education!=''">{{item.education}}</text>
							</view>
						</view>
					</view>
					<view class="trb_top_right">
				
						<image @click.stop="collRCTJ(item,index)" :src="item.follow==undefined?item.imgurl:item.imgurl"
							mode=""></image>
						<view>{{item.type}}</view>
					</view>
				</view>
				<view class="trb_bottom dis_flex">
					<view class="trb_bottom_left dis_flex">
						<text>所持证书：</text>
						<view class="tit" v-if="item.certs!=''">{{item.certs}}</view>
						<view class="tit"  v-if="item.certs==''">暂无</view>
					</view>
					<view class="trb_bottom_right">
						<text>{{item.reviewTime}}</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			nums: {
				type: Array
			}
		},
		data() {
			return {
				webImgUrl: '',
				dataList: this.nums,
				active_img: true,
				follow: 'false',
				sc_imgurl: '../../static/icon/shoucang.png',
				qx_imgurl: '../../static/icon/shoucang2.png',
				dataMain: {
					baseId: '', //用户id
					target: 'findjb', //关注类型   findrt-招聘   findjb
					targetId: '', //对象id
				},
				data:[],
				searchForm: {
					type: "",
					search: '',
					currentPage: 1,
					pageSize: 10,
					userId: ''
				},
				// data:{
				// 	currentPage:'1',
				// 	pageSize:10,
				// 	userId:''
				// },
			}
		},
		computed:{
			baseid() {
				return this.$store.state.userId
			}
		},
		watch: {
			//监听父级传过来的值并赋给dataList
			nums(res) {
				this.dataList = res
				// 收藏图标的切换
				for (var i = 0; i < this.dataList.length; i++) {
					if (this.dataList[i].follow == undefined) {
						this.$set(this.dataList[i], "imgurl", '../../static/icon/shoucang.png')
					}
					if (this.dataList[i].follow != undefined) {
						this.$set(this.dataList[i], "imgurl", '../../static/icon/shoucang2.png')
						// 显示推荐图标
						this.$set(this.dataList[i],'tuijianFollow')
						this.dataList[i].tuijianFollow=true
					}
				}
			}
		},
		created() {
			this.webImgUrl = this.$webUrl
			this.dataMain.baseId = this.baseid
			this.searchForm.userId = this.baseid
		},
		methods: {
		
			detail(item) {
				uni.navigateTo({
					url: '../../pageB/zhaopin1/talentdetail?id='+item.recruitId+'&follow='+item.follow
				})
			},
			// 职位推荐、人才推荐收藏方法
			collRCTJ(item,index) {
				this.dataMain.targetId = item.recruitId
				if (item.follow == undefined) {
					this.$myResquest.peronFollow(this.dataMain).then(res => {
						if (res.data.code == 200) {
							this.active_img = true
							// this.sc_imgurl = '../../static/icon/shoucang2.png'
							// 添加
							this.$set(this.dataList[index], 'follow', '111111')
							this.dataList[index].imgurl = '../../static/icon/shoucang2.png'
						}
					})
				} else {
					this.$myResquest.peronDisfollow(this.dataMain).then(res => {
						if (res.data.code == 200) {
							this.active_img = false
							// 添加
							this.$delete(this.dataList[index], 'follow')
							this.dataList[index].imgurl = '../../static/icon/shoucang.png'
						}
					})
				
				}
			
			}
		}
	}
</script>

<style lang="scss" scoped>
	.Talent_recommendation {
		margin-top: 20rpx;
		padding-top: 0 !important;
		background: #ffffff;

		.Talent_recommendation_head {
			height: 76rpx;
			display: flex;
			justify-content: space-between;
			padding: 0 8rpx;
			box-sizing: border-box;

			&:first-child {
				font-size: 32rpx;
				font-family: PingFang SC, PingFang SC-Bold;
				font-weight: 700;
				text-align: left;
				color: #5cd1ce;
			}

			.more {
				font-size: 24rpx;
				font-family: PingFang SC, PingFang SC-Medium;
				font-weight: 500;
				text-align: center;
				color: #999999;
			}
		}

		.Talent_recommendation_bottom {
			width: 100%;
			height: 214rpx;
			border-radius: 10rpx;
			box-shadow: 0px 0px 18rpx 0px rgba(0, 0, 0, 0.1);
			padding: 18rpx 16rpx;
			box-sizing: border-box;
			margin-top: 24rpx;

			.trb_top {
				.trb_top_left {
					max-width: 386rpx;
					justify-content: flex-start;

					image {
						width: 78rpx;
						height: 78rpx;
						border-radius: 50%;
					}

					.trbtl_right {
						margin-left: 8rpx;

						.trbtl_top {
							margin-bottom: 20rpx;
							display: flex;

							view {
								height: 36rpx;
								line-height: 36rpx;
								font-size: 32rpx;
								font-family: Adobe Heiti Std, Adobe Heiti Std-R;
								font-weight: R;
								text-align: left;
								color: #333333;
							}

							image {
								border-radius: 0;
								width: 46rpx;
								height: 36rpx;
								margin-left: 8rpx;
							}
						}

						.trbtl_bottom {
							height: 26rpx;
							font-size: 24rpx;
							font-family: PingFang SC, PingFang SC-Medium;
							font-weight: 500;
							text-align: left;
							color: #999999;
							.line {
								width: 2rpx;
								height: 26rpx;
								background: rgba(153, 153, 153, 1);
								margin: 0 10rpx;
							}
						}
					}
				}

				.trb_top_right {
					// height: 45px;
					text-align: right;

					image {
						width: 36rpx;
						height: 36rpx;
						margin-bottom: 28rpx;
					}

					view {
						width: 56rpx;
						height: 28rpx;
						font-size: 28rpx;
						font-family: PingFang SC, PingFang SC-Medium;
						font-weight: 500;
						text-align: left;
						color: #ff8943;
					}
				}
			}

			.trb_bottom {
				margin-top: 26rpx;

				.trb_bottom_left {
					text {
						font-size: 24rpx;
						font-family: PingFang SC, PingFang SC-Medium;
						font-weight: 500;
						text-align: left;
						color: #333333;
					}

					.tit {
						background: #5cd1ce;
						border-radius: 6rpx;
						color: #ffffff;
						padding: 0 10rpx;
						max-width: 340rpx;
						    overflow: hidden;
						    text-overflow: ellipsis;
						    white-space: nowrap;
					}
				}

				.trb_bottom_right {
					text {
						width: 138rpx;
						height: 24rpx;
						font-size: 24rpx;
						font-family: PingFang SC, PingFang SC-Medium;
						font-weight: 500;
						text-align: left;
						color: #999999;
					}
				}
			}
		}
	}
</style>
